<?php
/**
 * Created by PhpStorm.
 * User: 1
 * Date: 2017-03-14
 * Time: 15:30
 */

namespace app\domain;
use app\src\sunsun\filterVat\action\FilterVatClientAction;
use app\src\sunsun\filterVat\action\FilterVatDeviceInfoAction;
use sunsun\filter_vat\dal\FilterVatDeviceDal;


/**
 * Class SunsunFilterVatDomain
 * 过滤桶
 * @package app\domain
 */
class SunsunFilterVatDomain extends BaseDomain
{
    public function __construct($algInstance, $data)
    {
        parent::__construct($algInstance, $data);
    }

    public function sendMessage(){
        $did      = $this->_post('did','');
        $message = $this->_post('message','');
        $result   = (new FilterVatClientAction())->sendMessage($did,$message);
        $this->exitWhenError($result,true);
    }

    public function deviceInfo(){
        $did = $this->_post('did','');
        $result = (new FilterVatDeviceInfoAction())->deviceInfo($did);
        $this->exitWhenError($result,true);
    }

    public function clientCount(){
        $data = [
            'all_client_cnt'=>(new FilterVatClientAction())->allClientCount()
        ];
        $result = ['status'=>true,'info'=>$data];
        $this->exitWhenError($result,true);
    }

    public function sessionInfo(){
        $did = $this->_post('did','');
        $data =  (new FilterVatClientAction())->getSession($did);
        $result = ['status'=>true,'info'=>$data];
        $this->exitWhenError($result,true);
    }

    public function bindUid(){
        $did = $this->_post('did','');
        $uid = $this->_post('uid','',lang('uid_need'));

    }
}